<?php
/**
 * responsible for returning the appropriate mapper object for a specific domain object
 *
 */
class MapperFactory {
	
    static function getMapper( $type ) {
  
        $type = preg_replace( "/^.*_/", "", $type );
        $dir = strtolower($type);
        $mapper = "{$dir}_{$type}Mapper";
        if ( class_exists( $mapper ) ) {
            return new $mapper();
        }
        throw new Exception( "Unknown Mapper: $mapper" );
    }
}